<html>

	<head></head>
		<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
	<script>
		$(function(){
			popularTabela();
		});

		function popularTabela() {
			$(".row").remove();
			
			$.ajax({
				url:"/gestaoExperienciaProfissional/rest/pessoa",
				dataType: "json",
				type: "GET",
				success:function(result){
					$.each(result, function(i, item) {
						$("#teste").append("<tr class='row'><td>" + item.nome + "</td><td>" + item.email + "</td><td><a href='#' onclick='apagar("+item.id+")'>Apagar</a></td></tr>");

		            });
			  }});
		}

		function apagar(id){
			$.ajax({
				url:"/gestaoExperienciaProfissional/rest/pessoa/" + id,
				type: "DELETE",
				success:function(result){
					alert("Deletado com sucessos");
					popularTabela();
			  }});
		}
		
	</script>
	<body>
	<table id="teste" border="1">
		<tr><td><b>Nome</b></td><td><b>Email</b></td><td>Acao</td></tr>
	</table>
	
	<div>
		<a href='../gestaoExperienciaProfissional/cadastro.html' >Cadastrar</a>
	</div>
	</body>

</html>